home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / f1 / mdisk25.arj / TIMER.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-09-29  |  1.7 KB  |  67 lines

  1. {$A+,B-,D-,E-,F-,G+,I-,L-,N-,O-,R-,S-,V+,X-}
  2. Unit Timer;
  3. Interface
  4. Uses Dos;
  5.  
  6. { (c) Emilio David Diaus López }
  7. { Temporizadores para el control del tiempo }
  8. {
  9. 11. Timer: El Control Del Tiempo En El Programa
  10.  
  11. Este MóDulo Provee Diez Temporizadores Para Controlar El Tiempo, En Este Programa
  12. Mdisk Se Utilizan Para Controlar El Tiempo.
  13.    Inittimer;
  14.      Activa El Temporizador Con El NúMero Timer.
  15.    Gettimer;
  16.      Devuelve El NúMero De CentéSimas Pasadas Desde La ActivacióN Por
  17.      Medio De Inittimer;
  18.    Get_Timer_Vars;
  19.      Devuelve El Tiempo Pasado Desde La ActivacióN Por Medio De Inittimer;
  20.      En Horas, Minutos, Segundos Y CentéSimas.
  21. }
  22.  
  23. { Contadores }
  24. Var Itimer,Ftimer,Rtimer:Array[0..10] Of Longint;
  25.  
  26. { Inicia un contador de tiempo }
  27. Procedure Inittimer(Timer:Byte);
  28. { obtiene tiempo de un contador de tiempo }
  29. Function Gettimer(Timer:Byte):Longint;
  30.  
  31. { obtiene tiempo en horas, minutos y segundos }
  32.  
  33. Procedure Get_Timer_Vars(Timer:Byte;Var H,M,S,Cs:Word);
  34.  
  35. Implementation
  36.  
  37. Procedure Inittimer(Timer:Byte);
  38. Var  H,M,S,Cs:Word;
  39. Begin
  40.      Gettime(H,M,S,Cs);
  41.      Itimer[Timer]:=Cs+S*100+M*100*60+H*100*60*60;
  42. End;
  43.  
  44. Function Gettimer(Timer:Byte):Longint;
  45. Var  H,M,S,Cs:Word;
  46. Begin
  47.      Gettime(H,M,S,Cs);
  48.      Ftimer[Timer]:=Cs+S*100+M*100*60+H*100*60*60;
  49.      Rtimer[Timer]:=Ftimer[Timer]-Itimer[Timer];
  50.      Gettimer:=Rtimer[Timer];
  51. End;
  52.  
  53. Procedure Get_Timer_Vars(Timer:Byte;Var H,M,S,Cs:Word);
  54. Var Time:Longint;
  55. Begin
  56.      Time:=Gettimer(Timer);
  57.      H:=Word(Time Div 360000);
  58.      Time:=Word(Time Mod 360000);
  59.      M:=Word(Time Div 6000);
  60.      Time:=Word(Time Mod 6000);
  61.      S:=Word(Time Div 100);
  62.      Time:=Word(Time Mod 100);
  63.      Cs:=Time;
  64. End;
  65.  
  66. End.
  67.